home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / exampleCode / inventor / sharedSV / SoSceneMenu.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  8.7 KB  |  254 lines

  1. /*
  2.  * Copyright (c) 1991, 1992 Silicon Graphics, Inc.
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and
  5.  * its documentation for any purpose is hereby granted without fee, provided
  6.  * that the name of Silicon Graphics may not be used in any advertising or
  7.  * publicity relating to the software without the specific, prior written
  8.  * permission of Silicon Graphics.
  9.  *
  10.  * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
  11.  * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
  12.  * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
  13.  *
  14.  * IN NO EVENT SHALL SILICON GRAPHICS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
  15.  * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
  16.  * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF THE
  17.  * POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN
  18.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  19.  */
  20.  
  21. #ifndef  _SO_SCENE_MENU_
  22. #define  _SO_SCENE_MENU_
  23.  
  24. // -*- C++ -*-
  25. //
  26. // header for TopbarMenu
  27. //
  28.  
  29. #include <X11/Intrinsic.h>
  30. #include <Inventor/SbBasic.h>
  31.  
  32. enum MenuEntries {
  33.     SV_FILE = 0,  // start at 0 since we use an array
  34.     SV_FILE_ABOUT, 
  35.     SV_FILE_OPEN, 
  36.     SV_FILE_IMPORT, 
  37.     SV_FILE_NEW, 
  38.     SV_FILE_SAVE, 
  39.     SV_FILE_SAVE_AS, 
  40.     SV_FILE_SAVE_ENV, 
  41.     SV_FILE_READ_ENV, 
  42.     SV_FILE_PRINT, 
  43.     SV_FILE_QUIT, 
  44.     
  45.     SV_EDIT, 
  46.     SV_EDIT_PICK_PARENT, 
  47.     SV_EDIT_PICK_ALL, 
  48.     SV_EDIT_CUT, 
  49.     SV_EDIT_COPY, 
  50.     SV_EDIT_PASTE, 
  51.     SV_EDIT_DELETE, 
  52.     
  53.     SV_VIEW, 
  54.     SV_VIEW_PICK, 
  55. #ifdef EXPLORER
  56.     SV_VIEW_USER,
  57. #endif
  58.     SV_VIEW_EXAMINER, 
  59.     SV_VIEW_FLY, 
  60.     SV_VIEW_WALK, 
  61.     SV_VIEW_PLANE, 
  62.     SV_VIEW_SELECTION, 
  63.     SV_VIEW_FOG, 
  64.     SV_VIEW_ANTIALIASING, 
  65.     SV_VIEW_SCREEN_TRANSPARENCY, 
  66.     SV_VIEW_BLEND_TRANSPARENCY, 
  67.     SV_VIEW_DELAY_BLEND_TRANSPARENCY, 
  68.     SV_VIEW_SORT_BLEND_TRANSPARENCY, 
  69.     SV_VIEW_BKG_COLOR, 
  70.     
  71.     SV_EDITOR, 
  72.     SV_EDITOR_TRANSFORM, 
  73.     SV_EDITOR_MATERIAL, 
  74.     SV_EDITOR_COLOR, 
  75.  
  76.     SV_MANIP, 
  77.     SV_MANIP_HANDLEBOX, 
  78.     SV_MANIP_TRACKBALL, 
  79.     SV_MANIP_JACK,
  80.     SV_MANIP_XFBOX,
  81.     SV_MANIP_DRAGPOINT,
  82.  
  83. // rotateCylindrical rotateDisc RotateSpherical 
  84. // scale1 scale2 scale2Uniform scaleUniform 
  85. // translate1 translate2 
  86.  
  87.     SV_MANIP_NONE, 
  88.     SV_MANIP_REPLACE_ALL, 
  89.     
  90.     SV_LIGHT, 
  91.     SV_LIGHT_ADD_DIRECT, 
  92.     SV_LIGHT_ADD_POINT, 
  93.     SV_LIGHT_ADD_SPOT, 
  94.     SV_LIGHT_AMBIENT_EDIT, 
  95.     SV_LIGHT_TURN_ON, 
  96.     SV_LIGHT_TURN_OFF, 
  97.     SV_LIGHT_SHOW_ALL, 
  98.     SV_LIGHT_HIDE_ALL, 
  99.     
  100.     SV_SELECTION, 
  101.     SV_SEL_SINGLE_SELECT, 
  102.     SV_SEL_TOGGLE_SELECT, 
  103.     SV_SEL_SHIFT_SELECT, 
  104.     SV_SEL_LINE_HIGHLIGHT, 
  105.     SV_SEL_BBOX_HIGHLIGHT, 
  106.     SV_SEL_NO_HIGHLIGHT, 
  107.     SV_SEL_HIGHLIGHT_COLOR, 
  108.     
  109.     SV_MENU_NUM,    // this must be the last entry
  110. };
  111.  
  112.  
  113. // different types of menu item buttons
  114. enum MenuItems {
  115.     SV_SEPARATOR, 
  116.     SV_PUSH_BUTTON, 
  117.     SV_TOGGLE_BUTTON, 
  118.     SV_RADIO_BUTTON, 
  119. };
  120.  
  121. struct SoSceneViewerButton {
  122.     char        *name;
  123.     int        id;
  124.     int      buttonType; // PUSH, TOGGLE, RADIO
  125.     char    *accelerator; // e.g. "Alt <Key> p" or "Ctrl <Key> u"
  126.     char    *accelText;   // text that appears in the menu item
  127. };
  128. struct SoSceneViewerMenu {
  129.     char        *name;
  130.     int            id;
  131.     struct     SoSceneViewerButton *subMenu;
  132.     int        subItemCount;
  133. };
  134.  
  135.  
  136. static SoSceneViewerButton fileData[] = {
  137. #ifndef EXPLORER
  138.     {"About...",        SV_FILE_ABOUT,    SV_PUSH_BUTTON, 0, 0 },
  139.     {"",                SV_SEPARATOR },
  140.     {"New",            SV_FILE_NEW,    SV_PUSH_BUTTON, "Alt <Key> n", "Alt+n" },
  141.     {"Open...",            SV_FILE_OPEN,    SV_PUSH_BUTTON, "Alt <Key> o", "Alt+o" },
  142.     {"Import...",        SV_FILE_IMPORT,    SV_PUSH_BUTTON, "Alt <Key> i", "Alt+i" },
  143. #endif /* EXPLORER */
  144.     {"Save",            SV_FILE_SAVE,    SV_PUSH_BUTTON, "Alt <Key> s", "Alt+s" },
  145.     {"Save As...",        SV_FILE_SAVE_AS,    SV_PUSH_BUTTON, "Alt Shift <Key> s", "Alt+S" },
  146. #ifndef EXPLORER
  147.     {"",                SV_SEPARATOR },
  148.     {"Read Environment...", SV_FILE_READ_ENV,    SV_PUSH_BUTTON, 0, 0 },
  149.     {"Save Environment...", SV_FILE_SAVE_ENV,    SV_PUSH_BUTTON, 0, 0 },
  150.     {"",                SV_SEPARATOR },
  151. #endif
  152.     {"Print...",        SV_FILE_PRINT,    SV_PUSH_BUTTON, "Alt <Key> p", "Alt+p" },
  153. #ifndef EXPLORER
  154.     {"Quit",            SV_FILE_QUIT,    SV_PUSH_BUTTON, "Alt <Key> q", "Alt+q" },
  155. #endif /* EXPLORER */
  156. };
  157.  
  158. #ifndef EXPLORER
  159. static SoSceneViewerButton editData[] = {
  160.     {"Pick Parent",    SV_EDIT_PICK_PARENT, SV_PUSH_BUTTON, 0, 0 },
  161.     {"Pick All",    SV_EDIT_PICK_ALL, SV_PUSH_BUTTON, "Alt <Key> a", "Alt+a" },
  162.     {"",            SV_SEPARATOR },
  163.     {"Cut",        SV_EDIT_CUT,    SV_PUSH_BUTTON, "Alt <Key> x", "Alt+x" },
  164.     {"Copy",        SV_EDIT_COPY,    SV_PUSH_BUTTON, "Alt <Key> c", "Alt+c" },
  165.     {"Paste",        SV_EDIT_PASTE,    SV_PUSH_BUTTON, "Alt <Key> v", "Alt+v" },
  166.     {"Delete",        SV_EDIT_DELETE,    SV_PUSH_BUTTON, "<Key> BackSpace", 0 },
  167. };
  168. #endif /* EXPLORER */
  169.  
  170. static SoSceneViewerButton viewData[] = {
  171.     {"Pick/Edit",  SV_VIEW_PICK,           SV_TOGGLE_BUTTON, 0, 0},
  172. #ifdef EXPLORER
  173.     {"User Pick Mode",  SV_VIEW_USER,    SV_TOGGLE_BUTTON, 0, 0},
  174. #endif /* EXPLORER */
  175.     {"",       SV_SEPARATOR },
  176.     {"Examiner",   SV_VIEW_EXAMINER,        SV_RADIO_BUTTON, 0, 0},
  177.     {"Fly",       SV_VIEW_FLY,           SV_RADIO_BUTTON, 0, 0},
  178.     {"Walk",       SV_VIEW_WALK,           SV_RADIO_BUTTON, 0, 0},
  179.     {"Plane",       SV_VIEW_PLANE,           SV_RADIO_BUTTON, 0, 0},
  180.     {"",       SV_SEPARATOR },
  181.     {"View Selection",SV_VIEW_SELECTION,     SV_PUSH_BUTTON, 0, 0},
  182.     {"Fog",        SV_VIEW_FOG,            SV_TOGGLE_BUTTON, 0, 0},
  183.     {"Antialiasing",SV_VIEW_ANTIALIASING,   SV_TOGGLE_BUTTON, 0, 0},
  184.     {"",       SV_SEPARATOR },
  185.     {"Screen Door Transparency", SV_VIEW_SCREEN_TRANSPARENCY,  SV_RADIO_BUTTON, 0, 0},
  186.     {"Blended Transparency", SV_VIEW_BLEND_TRANSPARENCY,  SV_RADIO_BUTTON, 0, 0},
  187.     {"Delayed Blended Transparency", SV_VIEW_DELAY_BLEND_TRANSPARENCY,  SV_RADIO_BUTTON, 0, 0},
  188.     {"Sorted Blended Transparency", SV_VIEW_SORT_BLEND_TRANSPARENCY,  SV_RADIO_BUTTON, 0, 0},
  189.     {"",        SV_SEPARATOR },
  190.     {"Edit Background Color...", SV_VIEW_BKG_COLOR,  SV_PUSH_BUTTON, 0, 0}
  191. };
  192.  
  193. static SoSceneViewerButton editorData[] = {
  194.     {"Material Editor...",    SV_EDITOR_MATERIAL,    SV_PUSH_BUTTON, 0, 0},
  195.     {"Color Editor...",       SV_EDITOR_COLOR,       SV_PUSH_BUTTON, 0, 0},
  196.     {"Transform Sliders...",  SV_EDITOR_TRANSFORM,   SV_PUSH_BUTTON, 0, 0},
  197. };
  198.  
  199. static SoSceneViewerButton manipData[] = {
  200.     {"Trackball",   SV_MANIP_TRACKBALL,      SV_RADIO_BUTTON, 0, 0},
  201.     {"HandleBox",   SV_MANIP_HANDLEBOX,      SV_RADIO_BUTTON, 0, 0},
  202.     {"Jack",        SV_MANIP_JACK,           SV_RADIO_BUTTON, 0, 0},
  203.     {"TransformBox",SV_MANIP_XFBOX,          SV_RADIO_BUTTON, 0, 0},
  204.     {"DragPoint",   SV_MANIP_DRAGPOINT,      SV_RADIO_BUTTON, 0, 0},
  205.     {"None",        SV_MANIP_NONE,           SV_RADIO_BUTTON, 0, 0},
  206.     {"",            SV_SEPARATOR },
  207.     {"Replace",     SV_MANIP_REPLACE_ALL,    SV_TOGGLE_BUTTON, 0, 0}
  208. };
  209.  
  210. static SoSceneViewerButton lightData[] = {
  211.     {"Create Dir Light",        SV_LIGHT_ADD_DIRECT,    SV_PUSH_BUTTON, 0, 0},
  212.     {"Create Point Light",        SV_LIGHT_ADD_POINT,        SV_PUSH_BUTTON, 0, 0},
  213.     {"Create Spot Light",        SV_LIGHT_ADD_SPOT,        SV_PUSH_BUTTON, 0, 0},
  214.     {"",                SV_SEPARATOR },
  215.     {"Ambient Lighting...",        SV_LIGHT_AMBIENT_EDIT,  SV_PUSH_BUTTON, 0, 0},
  216.     {"",                SV_SEPARATOR },
  217.     {"Turn all ON",            SV_LIGHT_TURN_ON,        SV_PUSH_BUTTON, 0, 0},
  218.     {"Turn all OFF",            SV_LIGHT_TURN_OFF,        SV_PUSH_BUTTON, 0, 0},
  219.     {"Show all Icons",            SV_LIGHT_SHOW_ALL,        SV_PUSH_BUTTON, 0, 0},
  220.     {"Hide all Icons",            SV_LIGHT_HIDE_ALL,        SV_PUSH_BUTTON, 0, 0},
  221.     {"",                SV_SEPARATOR },
  222. };
  223.  
  224. #ifndef EXPLORER
  225. static SoSceneViewerButton selData[] = {
  226.     {"Single Selection", SV_SEL_SINGLE_SELECT,  SV_RADIO_BUTTON, 0, 0},
  227.     {"Toggle Selection", SV_SEL_TOGGLE_SELECT,  SV_RADIO_BUTTON, 0, 0},
  228.     {"Shift Selection",    SV_SEL_SHIFT_SELECT,    SV_RADIO_BUTTON, 0, 0},
  229.     {"",            SV_SEPARATOR },
  230.     {"No Highlight",    SV_SEL_NO_HIGHLIGHT,    SV_RADIO_BUTTON, 0, 0},
  231.     {"Line Highlight",    SV_SEL_LINE_HIGHLIGHT,    SV_RADIO_BUTTON, 0, 0},
  232.     {"Box Highlight",    SV_SEL_BBOX_HIGHLIGHT,    SV_RADIO_BUTTON, 0, 0},
  233.     {"",            SV_SEPARATOR },
  234.     {"Highlight Color...", SV_SEL_HIGHLIGHT_COLOR, SV_PUSH_BUTTON, 0, 0},
  235. };
  236. #endif /* EXPLORER */
  237.  
  238. static SoSceneViewerMenu pulldownData[] = {
  239. //  {name,     id,            subMenu,    subItemCount}
  240.     {"File",    SV_FILE,     fileData,   XtNumber(fileData)   },
  241. #ifndef EXPLORER
  242.     {"Edit",    SV_EDIT,     editData,   XtNumber(editData)   },
  243. #endif /* EXPLORER */
  244.     {"Viewing", SV_VIEW,     viewData,   XtNumber(viewData)   },
  245. #ifndef EXPLORER
  246.     {"Selection", SV_SELECTION, selData, XtNumber(selData)     },
  247. #endif /* EXPLORER */
  248.     {"Editors", SV_EDITOR,     editorData, XtNumber(editorData) },
  249.     {"Manips",  SV_MANIP,     manipData,  XtNumber(manipData)  },
  250.     {"Lights",  SV_LIGHT,     lightData,  XtNumber(lightData)  }
  251. };
  252.  
  253. #endif
  254.